﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <script src="/js/header.js"></script>
    <link href="/lib/jquery/jquery-ui.min.css" rel="stylesheet" />
    <script src="/lib/jquery/jquery-ui.min.js"></script>
</head>
<body>
    <div class="data-wrap case" id="container">
        <div class="data-tool clearfix">
            <div class="pull-left form-inline ">
                <a class="btn btn-default btn-sm" data-modal="/view/bank/edit.html" data-title="新增" data-width="482" data-height="535"><span class="glyphicon glyphicon-plus"></span> 新增</a>
            </div>
            <div class="pull-right">
                <form class="form-inline" id="formSearch">
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">银行代码：</label>
                        <input class="form-control" name="BankCode" type="text" />
                    </div>

                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">银行名称：</label>
                        <input class="form-control" name="BankName" type="text" />
                    </div>

                    <button type="button" class="btn btn-default btn-sm active" id="btnSearch"><span class="glyphicon glyphicon-search"></span> 搜索</button>
                </form>
            </div>
        </div>
        <div class="paging">
        </div>

    </div>
    <script type="text/x-dot-template" id="templatePager">
        <div class="data-body data-scroll">
            <div class="data-view">
                <div class="data-div-view table-responsive">
                    <table class="table table-hover table-striped table-bordered">
                        <thead>
                            <tr>
                                <th class="t_l" width="75">银行代码</th>
                                <th class="t_l" width="100">银行名称</th>
                                <th class="t_l" width="150">银行全部名称</th>
                                <th class="t_l" width="120">银行英文名称</th>
                                <th class="t_l" width="150">银行网址</th>
                                <th class="t_l" width="150">银行说明</th>
                                <th class="t_l" width="100">银行电话</th>
                                <th class="t_l" width="150">银行地址</th>
                                <th class="wd50">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {{? it.tData && it.tData.length>0}}
                            {{~it.tData :item:index}}
                            <tr>
                                <td class="t_l" width="75">{{? item.bankCode==null }}<span></span>{{?? }}{{= item.bankCode }}{{? }}</td>
                                <td class="t_l" width="100">{{= item.bankName }}</td>
                                <td class="t_l" width="150">{{? item.bankFullName==null }}<span></span>{{?? }}{{= item.bankFullName }}{{? }}</td>
                                <td class="t_l" width="120"><b>{{? item.bankEnglishName==null }}<span></span>{{?? }}{{= item.bankEnglishName }}{{? }}</b></td>
                                <td class="t_l" width="150">{{? item.bankUrl==null }}<span></span>{{?? }}{{= item.bankUrl }}{{? }}</td>
                                <td class="t_l" width="150" title={{= item.bankRemark }}>{{? item.bankRemark==null }}<span></span>{{?? }}{{= FlashPay.Util.GetShortStr(item.bankRemark) }}{{? }}</td>
                                <td class="t_l" width="100">{{? item.bankTel==null }}<span></span>{{?? }}{{= item.bankTel }}{{? }}</td>
                                <td class="t_l" width="150" title={{= item.bankAddress }}>{{? item.bankAddress==null }}<span></span>{{?? }}{{= FlashPay.Util.GetShortStr(item.bankAddress) }}{{? }}</td>
                                <td class="wd50">

                                    <button type="button" class="btn btn-default btn-xs" data-modal="/view/bank/edit.html?id={{= item.bankCode}}" data-title="编辑 - {{= item.bankName }}" data-width="452" data-height="535">
                                        <span class="glyphicon glyphicon-edit"></span> 编辑
                                    </button>

                                </td>
                            </tr>
                            {{~}}
                            {{??}}
                            <tr class="noRecord">
                                <td colspan="9">暂无记录！</td>
                            </tr>
                            {{?}}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- 必要的分页参数设置 -->
        <input type="hidden" id="TotalCount" value="{{=it.totalCount}}" />
    </script>
    

    <script type="text/javascript">
        $(function () {
            FlashPay.UI.DataAutoHeight();
            FlashPay.UI.DoSearch();

            $("#btnSearch").click(function () {
                window.currentPage = null;
                doSearch();
            });
        });

        $(document).keyup(function (event) {
            var keycode = event.which;
            if (keycode == 13) {
                FlashPay.UI.DoSearch();
            }
        }); 

        function doSearch() {
            FlashPay.UI.Pager(".paging", { templateId: "templatePager", pageSize: 15, ajax: { url: '/BankInfo/GetList', Method: 'Post' } });
        }

        //银行编号搜索
        $("input[name='BankCode']").autocomplete({
            minLength: 1,
            source: function (request, response) {
                FlashPay.Util.Ajax({
                    url: '/BankInfo/GetList',
                    type: 'POST',
                    data: "{ \"BankCode\":" + "\"" + $("input[name='BankCode']").val() +"\" }",
                    dataType: 'json',
                    contentType: 'application/json; charset=utf-8',
                    success: function (res) {
                        if (res.success) {
                            if (res.tData != null && res.tData.length > 0) {
                                response($.map(res.tData, function (item) {
                                    return {
                                        label: item.bankCode,
                                        value: item.bankCode,
                                        id: item.bankCode
                                    }
                                }))
                            }
                        } else {
                            FlashPay.UI.Tip_warning("操作失败！" + res.errorMessage);
                        }
                    },
                    error: function (json) {
                        FlashPay.UI.Tip_short_warning("操作失败！请查看网络，请重试。");
                    }
                });
            }
        });

        //银行名称搜索
        $("input[name='BankName']").autocomplete({
            minLength: 1,
            source: function (request, response) {
                FlashPay.Util.Ajax({
                    url: '/BankInfo/GetList',
                    type: 'POST',
                    data: "{ \"BankName\":" + "\"" + $("input[name='BankName']").val() + "\" }",
                    dataType: 'json',
                    contentType: 'application/json; charset=utf-8',
                    success: function (res) {
                        if (res.success) {
                            if (res.tData != null && res.tData.length > 0) {
                                response($.map(res.tData, function (item) {
                                    return {
                                        label: item.bankName,
                                        value: item.bankName,
                                        id: item.bankCode
                                    }
                                }))
                            }
                        } else {
                            FlashPay.UI.Tip_warning("操作失败！" + res.errorMessage);
                        }
                    },
                    error: function (json) {
                        FlashPay.UI.Tip_short_warning("操作失败！请查看网络，请重试。");
                    }
                });
            }
        });

        function Tip_success(word) {
            FlashPay.UI.Tip_success(word);
        }
    </script>
</body>
</html>